<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>

<script type="text/javascript" src="${ctx}/js/jquery.itextclear.js"></script>
<script type="text/javascript" src="${ctx}/js/Tree.js"></script>
<script type="text/javascript" src="${ctx}/js/employee.js"></script>
<script type="text/javascript" src="${ctx}/js/global_util.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        $('input[type=text], input[type=password], input[type=url], input[type=email], input[type=number], textarea', '.form').iTextClear();
    });
</script>
<!-- jQplot CSS -->

<link rel="stylesheet" media="screen" href="${ctx}/css/Tree.css"/>
<!-- jQplot CSS END -->

<!-- DATATABLES CSS -->
<link rel="stylesheet" media="screen" href="${ctx}/lib/datatables/css/vpad.css"/>
<script type="text/javascript" src="${ctx}/lib/datatables/js/jquery.dataTables.js"></script>

<!-- DATATABLES CSS END -->

<table class="display" id="list_content">
    <thead>
    <tr>
        <th>选择</th>
        <th>员工工号</th>
        <th>姓名</th>
        <th>性别</th>
        <th>出生日期</th>
        <th>身份证号码</th>
        <th>部门</th>
        <th>职务</th>
        <th>职等</th>
        <th>户籍</th>
        <th>档案所在地</th>
    </tr>
    </thead>
    <tbody>

    <s:iterator value="employeeinfoWorks" var="reg" status="sta">
        <s:if test="#sta.odd">
            <tr class="gradeA">
        </s:if>
        <s:else>
            <tr class="gradeB">
        </s:else>
        <td><input type="radio" name="select_staff" value="${reg.baseId.id}_${reg.baseId.name}" eid="${reg.baseId.id}" ename="${reg.baseId.name}" wid="${reg.id}" onclick="selectStaff(this)"/>
        </td>
        <td>${reg.workNo}</td>
        <td>${reg.baseId.name}</td>
        <td>${reg.baseId.sex=="0"?"男":"女"}</td>
        <td><s:date name="#reg.baseId.birthday" format="yyyy/MM/dd"/></td>
        <td>${reg.baseId.idcard}</td>
        <td>${reg.organization.fullName}</td>
        <td>${reg.duty.dutyName}</td>
        <td>${reg.grade.gradeName}</td>
        <td>${reg.baseId.census}</td>
        <td>${reg.baseId.archives}</td>
        </tr>
    </s:iterator>
    </tbody>
</table>
<p>
    <%@ include file="/WEB-INF/pages/common/main_pager_tipsWindown.jsp" %>
</p>


<p align="center">
    <button class="button" type="button" onclick="selectEployee()">确定</button>
    <button class="button" type="button" onclick="cancelEployee()">取消</button>
</p>

<script type="text/javascript">
    var selectName="";
    function selectStaff(obj) {
        selectName=obj.value;
    }

    function toUrl(){
        if(selectName==""){
            alert('请先选择一个员工');
            return;
        }
        var strs=selectName.split("_");
        var url='#user/user_add.xhtml?id='+strs[0]+"&organizationId=${organizationId}";
        window.location.href=encodeURI(url);
    }


    //add.wxn#start
    function cancelEployee(){
        closeWindown();
    }
    function selectEployee(){
        //var value = $("input:radio[name='select_staff']").val();
        var obj = $("input:radio[name='select_staff'][checked]");
        onSelectEployee($(obj).attr("eid"), $(obj).attr("ename"), $(obj).attr("wid"));
        cancelEployee();
    }
    /* //员工选择翻页处理
    function pageDo(obj) {
        pageHref('${ctx}/${pageUrl}?page='+obj.value);
    }
    function pageHref(url) {
    	alert("yyyyyyy");
        url = url + '&${queryString}';
        //如果有搜索的，请将搜索的Form的Id指定为searchForm
        var searchForm = $("#searchForm");
        //alert(searchForm.length);
        //搜索的时候，要同时提交搜索的表单
        if(searchForm != null && searchForm.length > 0) {
            searchForm.attr("action", url);
            searchForm.submit();
        }
        //非搜索时
        else {
            //window.location.href = url;
            pageTo(url);
        }
    }

    function pageTo(url){
        $.ajax(url, {
            type: "POST",
            data:{"operation":"select"},
            dataType:"html",
            cache:false,
            success:function(a) {
                var obj = $("#windown-content");
                obj.html("");
                obj.append(a);
            },
            complete:function() {
            }
        });
    } */
    //add.wxn#end
</script>